package com.zl.learning.json.fastjson;

import com.alibaba.fastjson.JSON;
import org.junit.Test;

public class TestCopyData {
    @Test
    public void test1() {
        UserVo userVo = new UserVo();
        userVo.setUsername("zhangsan");
        userVo.setPassword("123456");
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100; i++) {
            UserPo userPo = JSON.parseObject(JSON.toJSONString(userVo), UserPo.class);
        }
        long end = System.currentTimeMillis();
        System.out.println("const :" + (end - start));
        for (int i = 0; i < 100; i++) {
            UserPo userPo = new UserPo();
            userPo.setUsername(userVo.getUsername());
            userPo.setPassword(userVo.getPassword());
        }
        long end2 = System.currentTimeMillis();
        System.out.println("const :" + (end2 - end));
    }
}
